package com.hiultra.archive.service.impl;

import java.util.List;

import com.hiultra.archive.domain.ArcBox;
import com.hiultra.common.constant.UserConstants;
import com.hiultra.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hiultra.archive.mapper.SimfExamineMapper;
import com.hiultra.archive.domain.SimfExamine;
import com.hiultra.archive.service.ISimfExamineService;

/**
 * 审批Service业务层处理
 * 
 * @author ls
 * @date 2023-09-25
 */
@Service
public class SimfExamineServiceImpl implements ISimfExamineService 
{
    @Autowired
    private SimfExamineMapper simfExamineMapper;

    /**
     * 查询审批
     * 
     * @param examineId 审批主键
     * @return 审批
     */
    @Override
    public SimfExamine selectSimfExamineByExamineId(Long examineId)
    {
        return simfExamineMapper.selectSimfExamineByExamineId(examineId);
    }

    /**
     * 查询审批列表
     * 
     * @param simfExamine 审批
     * @return 审批
     */
    @Override
    public List<SimfExamine> selectSimfExamineList(SimfExamine simfExamine)
    {
        return simfExamineMapper.selectSimfExamineList(simfExamine);
    }

    /**
     * 新增审批
     * 
     * @param simfExamine 审批
     * @return 结果
     */
    @Override
    public int insertSimfExamine(SimfExamine simfExamine)
    {
        return simfExamineMapper.insertSimfExamine(simfExamine);
    }

    /**
     * 修改审批
     * 
     * @param simfExamine 审批
     * @return 结果
     */
    @Override
    public int updateSimfExamine(SimfExamine simfExamine)
    {
        return simfExamineMapper.updateSimfExamine(simfExamine);
    }

    /**
     * 批量删除审批
     * 
     * @param examineIds 需要删除的审批主键
     * @return 结果
     */
    @Override
    public int deleteSimfExamineByExamineIds(Long[] examineIds)
    {
        return simfExamineMapper.deleteSimfExamineByExamineIds(examineIds);
    }

    /**
     * 删除审批信息
     * 
     * @param examineId 审批主键
     * @return 结果
     */
    @Override
    public int deleteSimfExamineByExamineId(Long examineId)
    {
        return simfExamineMapper.deleteSimfExamineByExamineId(examineId);
    }

    /**
     * 校验流程编号是否唯一
     *
     * @param simfExamine 流程
     * @return 结果
     */
    @Override
    public String checkExamineCodeUnique(SimfExamine simfExamine){
        Long examineId = StringUtils.isNull(simfExamine.getExamineId()) ? -1L : simfExamine.getExamineId();
        SimfExamine info = simfExamineMapper.checkExamineCodeUnique(simfExamine);
        if (StringUtils.isNotNull(info) && info.getExamineId().longValue() != examineId.longValue()) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }
    /**
     * 校验流程编号是否唯一
     *
     * @param simfExamine 流程
     * @return 结果
     */
    @Override
    public String checkExamineNameUnique(SimfExamine simfExamine){
        Long examineId = StringUtils.isNull(simfExamine.getExamineId()) ? -1L : simfExamine.getExamineId();
        SimfExamine info = simfExamineMapper.checkExamineNameUnique(simfExamine);
        if (StringUtils.isNotNull(info) && info.getExamineId().longValue() != examineId.longValue()) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }
}
